home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 16 / AMIGAplus Sonderheft 16 (1998)(ICP)(DE)[!].iso / pd / anwendungen / viewtool / install / install-script < prev    next >
Text File  |  1998-01-18  |  35KB  |  918 lines

  1. ;
  2. ;$VER: Install-Script 1.1 (17.01.98)
  3. ;               
  4. ;======================
  5. ;=== Global strings ===
  6. ;======================
  7. (set #installer_locale 0) 
  8. ;
  9. ; Determine language
  10. ;
  11. ; #installer_locale = 0: english
  12. ;                   = 1: deutsch
  13. ;                           
  14. (if (= @language "deutsch") (set #installer_locale 1))
  15. ;
  16. ;English
  17. ;
  18. (if (= #installer_locale 0)
  19.     (set            
  20.         ;=== general ===
  21.         ;
  22.         #welcome_text        (cat "This script lets you install\n" @app-name "\non your system.")
  23.         #welcome_update      (cat "This script will update an existing\n" @app-name "\ninstallation.")
  24.         #welcome_remove      (cat "This script will remove an existing\n" @app-name "\ninstallation.")
  25.         #error_instvers_msg  (cat "You are using the installer version %ld.%ld.\n"
  26.                                   "This script will probably not work.\n"
  27.                                   "Try installing anyway ?")
  28.         #error_instvers_help (cat "Get the most resent version from http://www.amiga.de\nVersion 42.9+ is required.")
  29.         #action_prompt       (cat "What do you want to do ?")
  30.         #action_help         (cat "Select an action to perform.")
  31.         #action_install      (cat "Install")
  32.         #action_update       (cat "Update")
  33.         #action_remove       (cat "Remove")
  34.         #cpu_too_low         (cat "You have installed a " (database "cpu") " processor, but a 68020 processor "
  35.                                   "is minimal required in order to use " @app-name ".\nI'm quitting now...")
  36.         ;=== program files ===
  37.         ;
  38.         #askdest_prompt    (cat "Select destination for " @app-name ". A drawer will be created, if necessary.")
  39.         #askdest_help      (cat "Select the destination drawer for " @app-name ". A new drawer will be generated.")
  40.         #files2copy_prompt (cat "Select main program to install.")
  41.         #files2copy_help   (cat "Select the program file to install according to the processor your system has.")
  42.         #copycopy_prompt   (cat "The %s version of " @app-name " will be copied.")
  43.         #copycopy_help     (cat #copycopy_prompt)
  44.         ;=== catalogs ===
  45.         ;
  46.         #catalog_f2c_prompt (cat "Select language catalog to copy.")
  47.         #catalog_f2c_help   (cat "Select the language(s) to install.")
  48.         #getcat_prompt      (cat "Select target drawer for catalog(s). A drawer will be created, if necessary.")
  49.         #getcat_help        (cat "Normally, select the drawer the main program was installed to. "
  50.                                  "A new drawer will be generated, if necessary. "
  51.                                  "LOCALE: would be another option.")
  52.         #copycat_prompt     (cat "Copying %s catalog...")
  53.         #copycat_help       (cat "The %s catalog files will be copied.")
  54.         ;=== guide ===
  55.         ;
  56.         #guide_f2c_prompt (cat "Select documentation to install.")
  57.         #guide_f2c_help   (cat "Select documentation language you like to install.")
  58.         #getdoc_prompt    (cat "Select destination for documentation. A drawer will be created, if necessary.")
  59.         #getdoc_help      (cat "Normally, select the drawer the main program was installed to. "
  60.                                "A new drawer will be generated, if necessary.")
  61.         #copydoc_prompt   (cat "Copying documentation...")
  62.         #copydoc_help     (cat "The %s documentation will be copied.")
  63.         #copydoc_misc_pmt (cat "Copying miscellaneous documentation...")
  64.         #copydoc_misc_hlp (cat "Some additional texts will be copied.")
  65.         ;=== arexx ===
  66.         ;
  67.         #rexx_f2c_prompt  (cat "Install arexx examples ?")
  68.         #rexx_f2c_help    (cat "Select wether to install the example arexx files or not.")
  69.         #rexx_dest_prompt (cat "Select arexx example drawer. A new drawer will be created, if necessary.")
  70.         #rexx_dest_help   (cat "Select a drawer into which the example arexx files will be installed. "
  71.                                "A new drawer will be generated, if necessary.")
  72.         #rexx_copy_prompt (cat "Copying arexx examples...")
  73.         #rexx_copy_help   (cat "The arexx example files will be copied.") 
  74.         ;=== wbstartup ===
  75.         ;
  76.         #cpy_wbstartup_prompt (cat "Start " @app-name " automatically every time you boot ?")
  77.         #cpy_wbstartup_help   (cat "An icon will be copied to SYS:WBStartup/ drawer. Every time you boot "
  78.                                    @app-name " will be started automatically. Select the program version "
  79.                                    "to be started.")
  80.         #cpy_wbstart_none     (cat "No")       
  81.         #wbstart_prompt       (cat "The %s client will be started on boot time.")
  82.         #wbstart_help         (cat "The selected version of " @app-name " will be started during booting.")
  83.         ;=== tooltypes ===
  84.         ;
  85.         #ttype_prefs_prompt (cat "Since %s is a commodity some setup is required.\n"
  86.                                  "Type the keys which will bring up the preferences window, "
  87.                                  "for example\n'lshift lalt v' (= left shift + left alt + v):"
  88.                             )
  89.         #ttype_prefs_help   (cat "Type in a combination of keys, but without then \'.")
  90.         #ttype_load_prompt  (cat "Type the keys which will bring up a file load requester:")
  91.         #ttype_load_help    (cat "Same as previous. " #ttype_prefs_help)
  92.         #ttype_popup_prompt (cat "Should the preferences window open automatically after program start ?")
  93.         #ttype_popup_help   (cat "You can change this later via the tooltype CX_POPUP=<YES|NO>.")
  94.         #ttype_set_prompt   (cat "The requested changes to the %s program icon will be made.")
  95.         #ttype_set_help     (cat "All changes can be manually altered later.")
  96.         ;=== update drawer ===
  97.         ;
  98.         #update_dest_prompt (cat "Locate " @app-name "'s executable(s):")
  99.         #update_dest_help   (cat "Select the drawer where " @app-name "'s executable(s) resides in.")
  100.         #update_f2c_prompt  (cat "Select executables to update:")
  101.         #update_f2c_help    (cat "Select that executable(s) which should be updated.")
  102.         #update_cat_prompt  (cat "Select drawer where old catalogs were installed:")
  103.         #update_cat_help    (cat "This should be either the drawer where the executables reside in "
  104.                                  "or LOCALE:")
  105.         #update_no_exe      (cat "Couldn't find files to update. Exitting...")
  106.         ;=== remove drawer ===
  107.         ;                             
  108.         #remove_safe_prompt (cat "Do you really want to delete your\n" @app-name "\ninstallation ?")
  109.         #remove_safe_help   (cat "This is the last chance to cancel !!!")
  110.         #remove_del_prompt  (cat "Deleting old\n" @app-name "\ninstallation.")
  111.         #remove_del_help    (cat "You will get no second chance to quit !!!")
  112.         #remove_no_exe      (cat "Didn't find " @app-name " executable(s) in selected drawer. Exitting...")
  113.     )
  114. )
  115. ;
  116. ; Deutsch
  117. ;
  118. (if (= #installer_locale 1)
  119.     (set
  120.         ;=== general ===
  121.         ;
  122.         #welcome_text        (cat "Dieses Script installiert\n" @app-name "\nauf Ihrem System.")
  123.         #welcome_update      (cat "Dieses Script erneuert eine vorhandene Installation von\n" @app-name)
  124.         #welcome_remove      (cat "Dieses Script entfernt eine vorhandene Installation von\n" @app-name)
  125.         #error_instvers_msg  (cat "Sie benutzen den Installer in der Version %ld.%ld.\n"
  126.                                   "Die Installations wird wahrscheinlich nicht funktionieren.\n"
  127.                                   "Installation dennoch versuchen ?")
  128.         #error_instvers_help (cat "Die neueste Version ist zu finden unter http://www.amiga.de\nVersion 42.9+ wird benötigt.")
  129.         #action_prompt       (cat "Was wollen Sie ausführen ?")
  130.         #action_help         (cat "Wählen Sie eine Aktion.")
  131.         #action_install      (cat "Installieren")
  132.         #action_update       (cat "Erneuern")
  133.         #action_remove       (cat "Entfernen")
  134.         #cpu_too_low         (cat "Sie haben einen " (database "cpu") " Prozessor installiert, aber um " @app-name
  135.                                   " zu benutzen, benötigen Sie mindestens einen 68020 Prozessor.\nDie Installation "
  136.                                   "wird nun abgebrochen...")      
  137.         ;=== program files ===
  138.         ;           
  139.         #askdest_prompt    (cat "Zielverzeichnis für " @app-name " wählen. Es wird ein neues Verzeichnis erstellt, falls nötig.")
  140.         #askdest_help      (cat "Wählen Sie das Zielverzeichnis, in das " @app-name "installiert werden "
  141.                                 "soll. Es wird ein neues Verzeichnis erstellt.")
  142.         #files2copy_prompt (cat "Wählen Sie das zu installierende Hauptprogramm.")
  143.         #files2copy_help   (cat "Wählen Sie das zu installierende Hauptprogramm, das dem Prozessor Ihres System entspricht.")
  144.         #copycopy_prompt   (cat "Die %s Version von " @app-name " wird installiert.")
  145.         #copycopy_help     (cat #copycopy_prompt)
  146.         ;=== catalogs ===
  147.         ;
  148.         #catalog_f2c_prompt (cat "Wählen Sie den zu installierenden Sprach-Katalog.")
  149.         #catalog_f2c_help   (cat "Wählen Sie die Sprache, die das Hauptprogramm benutzen soll.")
  150.         #getcat_prompt      (cat "Zielverzeichnis für Katalog(e) wählen. Ein Verzeichnis wird erstellt, falls nötig.")
  151.         #getcat_help        (cat "Normalerweise sollte dasselbe Verzeichnis gewählt werden, "
  152.                                  "in welches das Hauptprogramm installiert wurde. Ein Verzeichnis "
  153.                                  "wird erstellt, falls nötig. LOCALE: wäre eine andere Möglichkeit.")
  154.         #copycat_prompt     (cat "Installiere %s Katalog...")
  155.         #copycat_help       (cat "Die %s Katalog-Dateien werden installiert.")
  156.         ;=== guide ===
  157.         ;
  158.         #guide_f2c_prompt (cat "Wählen Sie die zu installierende Dokumentation.")
  159.         #guide_f2c_help   (cat "Wählen Sie die Sprache der Dokumentation, die installiert werden soll.")
  160.         #getdoc_prompt    (cat "wählen Sie das Zielverzeichnis für die Dokumentation. Ein neues Verzeichnis wird erstellt, falls nötig.")
  161.         #getdoc_help      (cat "Normalerweise sollte dasselbe Verzeichnis gewählt werden, "
  162.                                " in welches das Hauptprogramm installiert wurde. Ein Verzeichnis "
  163.                                "wird erstellt, falls nötig.")
  164.         #copydoc_prompt   (cat "Installiere Dokumentation...")
  165.         #copydoc_help     (cat "Die %s Dokumentation wird installiert.")
  166.         #copydoc_misc_pmt (cat "Installiere zusätzliche Dokumentationen...")
  167.         #copydoc_misc_hlp (cat "Einige Texte mit zusätzliche Informationen werden installiert.")
  168.         ;=== arexx ===
  169.         ;
  170.         #rexx_f2c_prompt  (cat "ARexx-Beispieldateien installieren ?")
  171.         #rexx_f2c_help    (cat "Wählen Sie, ob die ARexx-Beispieldateien installiert werden sollen oder nicht.")
  172.         #rexx_dest_prompt (cat "Wählen Sie das Zielverzeichnis für die ARexx-Beispieldateien. Ein neues Verzeichnis "
  173.                                "wird erstellt, falls nötig.")
  174.         #rexx_dest_help   (cat "Wählen Sie das Verzeichnis, in welches die ARexx-Beispieldateien installiert "
  175.                                "werden sollen. Es wird ein neues Verzeichnis erstellt, falls nötig.")
  176.         #rexx_copy_prompt (cat "Installiere ARexx-Beispieldateien...")
  177.         #rexx_copy_help   (cat "Die ARexx-Beispieldateien werden kopiert.") 
  178.         ;=== wbstartup ===
  179.         ;                           
  180.         #cpy_wbstartup_prompt (cat @app-name " beim booten automatisch starten ?")
  181.         #cpy_wbstartup_help   (cat "Ein Piktogramm wird in das Verzeichnis SYS:WBStartup/ kopiert. "
  182.                                    "Jedesmal, wenn der Rechner bootet, wird " @app-name " automatisch gestartet. "
  183.                                    "Wählen Sie das zu startende Hauptprogramm.")
  184.         #cpy_wbstart_none     (cat "Nein")       
  185.         #wbstart_prompt       (cat "Die %s Version des Hauptprogramms wird beim booten gestartet.")
  186.         #wbstart_help         (cat "Die ausgewählte Version des Hauptprogramm von " @app-name " wird gestartet, "
  187.                                    "wenn der Rechner bootet.")          
  188.         ;=== tooltypes ===
  189.         ;
  190.         #ttype_prefs_prompt (cat "Da %s ein Commodity ist, müssen noch einige Einstellungen vorgenommen werden.\n"
  191.                                  "Geben Sie die Tastenkombination ein, mit der das Voreinstellungsfenster geöfnet werden soll, "
  192.                                  "z.B.\n'lshift lalt v' (= linke Shift-Taste + linke Alt-Taste + v):"
  193.                             )
  194.         #ttype_prefs_help   (cat "Geben Sie ein Tastenkombination ein, jedoch ohne \'.")
  195.         #ttype_load_prompt  (cat "Geben Sie die Tasenkonbination ein, die eine Dateiabfrage öffnet:")
  196.         #ttype_load_help    (cat "Wie vorherige. " #ttype_prefs_help)
  197.         #ttype_popup_prompt (cat "Soll das Voreinstellungsfenster automatisch nach dem Programmstart geöffnet werden ?")
  198.         #ttype_popup_help   (cat "Sie können dies später ändern über das ToolType CX_POPUP=<YES|NO>.")
  199.         #ttype_set_prompt   (cat "Die geforderten Änderung werden am %s Piktogramm vorgenommen.")
  200.         #ttype_set_help     (cat "Alle Anpassungen können später wieder von Hand geändert werden.")
  201.         ;=== update drawer ===
  202.         ;
  203.         #update_dest_prompt (cat "Wo befindet sich die Hauptprogramme der alten Installation von\n" @app-name " ?")
  204.         #update_dest_help   (cat "Wählen Sie das Verzeichnis, in welches die Hauptprogramme (oder das "
  205.                                  "Hauptprogramm) von " @app-name " installiert worden war(en).")
  206.         #update_f2c_prompt  (cat "Zu erneuernde(s) Hauptprogramm(e) wählen:")
  207.         #update_f2c_help    (cat "Wählen Sie das/die zu erneuernde(s) Hauptprogramm(e).")
  208.         #update_cat_prompt  (cat "Wählen Sie das Verzeichnis, in dem die Kataloge installiert sind.")
  209.         #update_cat_help    (cat "Dies sollte das Hauptprogramm-Verzeichnis sein oder LOCALE:")
  210.         #update_no_exe      (cat "Kann keine zu erneuernden Dateien finden. Breche ab...")
  211.         ;=== remove drawer ===
  212.         ;
  213.         #remove_safe_prompt (cat "Wollen Sie wirklich Ihre Installation von\n" @app-name "\nentfernen ?")
  214.         #remove_safe_help   (cat "Dies ist die letzte Chance abzubrechen !!!")
  215.         #remove_del_prompt  (cat "Entferne alte\n" @app-name "-Installation.")
  216.         #remove_del_help    (cat "Sie werden keine zweite Chance zum Abbruch bekommen !!!")
  217.         #remove_no_exe      (cat "Konnte kein(e) " @app-name " Hauptprogramm(e) im gewählten Verzeichnis "
  218.                                  "finden. Breche ab...")
  219.     )
  220. )
  221.   
  222. ;======================================
  223. ;=== Get install destination drawer ===
  224. ;======================================
  225. (procedure P_GetDestination
  226.     (debug "Ask destination drawer:")
  227.     (P_GetDestBaseDrawer)
  228.     (set @default-dest (tackon @default-dest @app-name))   
  229.     (debug "Destination drawer is" @default-dest ".\n")      
  230. )
  231.  
  232. (procedure P_GetDestBaseDrawer      
  233.     (set @default-dest 
  234.         (askdir
  235.             (prompt  #askdest_prompt)
  236.             (help    #askdest_help "\n\n" @askdir-help)
  237.             (default "RAM:")
  238.             (newpath)
  239.         ) 
  240.     )                                                   
  241. )
  242.  
  243. ;===============================
  244. ;=== Copy main program files ===
  245. ;===============================
  246. (procedure P_CopyMainFiles
  247.     ;;;
  248.     ; Get destination drawer
  249.     ;;;
  250.     (P_GetDestination)
  251.     ;;;
  252.     ; Select main program files to install
  253.     ;;;
  254.     (set #program_files2copy
  255.         (askoptions
  256.             (prompt  #files2copy_prompt)
  257.             (help    #files2copy_help "\n\n" @askoptions-help)
  258.             (choices (cat @app-name "68k")
  259.                      (cat @app-name "68k FPU")
  260.                      (cat @app-name "PPC")      
  261.             )
  262.             (default 0)
  263.         )
  264.     )                                            
  265.     (if (= #program_files2copy 0) (exit (quiet)))
  266.     ;;;
  267.     ; Generate destination drawer
  268.     ;;;
  269.     (makedir @default-dest
  270.         (infos)
  271.     )
  272.     (debug "Drawer" @default-dest "generated.")
  273.     ;;;
  274.     ; Copy requested files
  275.     ;;;
  276.     (if (IN #program_files2copy 0) (P_CopyOneExecutable "68k")) 
  277.     (if (IN #program_files2copy 1) (P_CopyOneExecutable "68k_fpu"))
  278.     (if (IN #program_files2copy 2) (P_CopyOneExecutable "PPC"))
  279.     (debug "Main files copied.\n")
  280. )
  281.  
  282. (procedure P_CopyOneExecutable #exe_name
  283.     (debug ("Copying %s files..." #exe_name))
  284.     (copyfiles
  285.         (prompt (#copycopy_prompt #exe_name))
  286.         (help   (#copycopy_help #exe_name) "\n\n" @copyfiles-help)
  287.         (source "/")
  288.         (dest   @default-dest)
  289.         (pattern (cat "#?" #exe_name "#?"))
  290.         (infos)
  291.         (confirm)
  292.     )
  293. )
  294.  
  295. ;=====================
  296. ;=== Copy catalogs ===
  297. ;=====================         
  298. (procedure P_CopyCatalogs 
  299.     (debug "Ask catalogs to copy:")
  300.     ;;;
  301.     ; Select catalogs to copy
  302.     ;;;
  303.     (if (= @user-level 2)
  304.         (
  305.             (debug "Ask catalog language.")
  306.             (set #catalog_files2copy
  307.                 (askoptions
  308.                     (prompt  #catalog_f2c_prompt)
  309.                     (help    #catalog_f2c_help "\n\n" @askoptions-help)
  310.                     (choices "english (built in)"
  311.                              "deutsch"
  312.                     )
  313.                     (default (shiftleft 1 #installer_locale))
  314.                 )
  315.             )
  316.         )
  317.         ;else
  318.         (
  319.             (debug "Copy install script language catalog.")           
  320.             (set #catalog_files2copy (shiftleft 1 #installer_locale))
  321.         )
  322.     )
  323.     ;;;
  324.     ; Get catalog drawer
  325.     ;;;
  326.     (if (= @user-level 2)
  327.         (
  328.             (debug "Ask target drawer for catalogs.")
  329.             (set #copycat_target
  330.                 (askdir
  331.                     (prompt  #getcat_prompt)
  332.                     (help    #getcat_help "\n\n" @askdir-help)
  333.                     (default @default-dest)
  334.                     (newpath)
  335.                 )
  336.             )
  337.         )
  338.         ;else
  339.         (
  340.             (debug "Set target for catalogs to default destination.")
  341.             (set #copycat_target @default-dest)
  342.         )
  343.     )                                                
  344.     ;;;
  345.     ; Create drawer
  346.     ;;;
  347.     (set #copycat_target
  348.         (tackon #copycat_target "Catalogs")
  349.     )
  350.     (makedir #copycat_target)
  351.     (debug "Selected drawer for catalogs is" #copycat_target ".\n")
  352.     ;;;
  353.     ; Copy catalogs
  354.     ;;;                                                              
  355.     (if (IN #catalog_files2copy 0) (P_CopyOneCatalog "english")) 
  356.     (if (IN #catalog_files2copy 1) (P_CopyOneCatalog "deutsch")) 
  357.     (debug "Catalogs copied.\n")
  358. )
  359.  
  360. (procedure P_CopyOneCatalog #language_name  
  361.     (debug ("Copying %s catalog to %s." #language_name #copycat_target))
  362.     (makedir (tackon #copycat_target #language_name))                    
  363.     (copyfiles
  364.         (prompt (#copycat_prompt #language_name))
  365.         (help   (#copycat_help #language_name) "\n\n" @copyfiles-help)
  366.         (source (cat "/Catalogs/" #language_name "/"))
  367.         (dest   (tackon #copycat_target (cat #language_name "/")))
  368.         (all)
  369.         (confirm)
  370.     )
  371. )
  372.  
  373. ;=================
  374. ;=== Copy docs ===
  375. ;=================
  376. (procedure P_CopyDocs
  377.     (debug "Ask guide to copy:")
  378.     ;;;
  379.     ; Select docs to copy
  380.     ;;;
  381.     (if (= @user-level 2)
  382.         (
  383.             (debug "Ask documentation language.")
  384.             (set #catalog_files2copy
  385.                 (askchoice
  386.                     (prompt  #guide_f2c_prompt)
  387.                     (help    #guide_f2c_help "\n\n" @askchoice-help)
  388.                     (choices "english"
  389.                              "deutsch"
  390.                     )
  391.                     (default #installer_locale)
  392.                 )
  393.             )
  394.         )
  395.         ;else
  396.         (
  397.             (debug "Copy install script language documentation.")
  398.             (set #catalog_files2copy #installer_locale)
  399.         )
  400.     )
  401.     ;;;
  402.     ; Get doc drawer    
  403.     ;;;
  404.     (if (= @user-level 2)
  405.         (
  406.             (debug "Ask target drawer for docs.")
  407.             (set #copydoc_target
  408.                 (askdir
  409.                     (prompt  #getdoc_prompt)
  410.                     (help    #getdoc_help "\n\n" @askdir-help)
  411.                     (default @default-dest)
  412.                     (newpath)
  413.                 )
  414.             )
  415.         )
  416.         ;else
  417.         (
  418.             (debug "Set target for docs to program drawer.")
  419.             (set #copydoc_target @default-dest)
  420.         )
  421.     )                                             
  422.     ;;;
  423.     ; Create drawer
  424.     ;;;
  425.     (set #copydoc_target
  426.         (tackon #copydoc_target "Guide")
  427.     )
  428.     (makedir #copydoc_target)    
  429.     ;;;
  430.     ; Copy docs
  431.     ;;;
  432.     (if (= #catalog_files2copy 0) (P_CopyOneGuide "English.guide"))  
  433.     (if (= #catalog_files2copy 1) (P_CopyOneGuide "Deutsch.guide"))  
  434.     ;;;
  435.     ; Copy miscellaneous texts
  436.     ;;;
  437.     (copyfiles
  438.         (prompt  #copydoc_misc_pmt)
  439.         (help    #copydoc_misc_hlp "\n\n" @copyfiles-help)
  440.         (source  "/Guide/")
  441.         (dest    #copydoc_target)
  442.         (pattern "#?.txt")
  443.     )
  444.     (debug "Guides copied.\n")
  445. )
  446.  
  447. (procedure P_CopyOneGuide #guide_name
  448.     (debug ("Copying %s." #guide_name))
  449.     (copyfiles
  450.         (prompt  (#copydoc_prompt #guide_name))
  451.         (help    (#copydoc_help #guide_name) "\n\n" @copyfiles-help)
  452.         (source  (cat "/Guide/" #guide_name))
  453.         (dest    #copydoc_target) 
  454.         (newname (cat @app-name ".guide"))
  455.         (confirm)
  456.     )   
  457.     (copyfiles
  458.         (prompt  (#copydoc_prompt #guide_name))
  459.         (help    (#copydoc_help #guide_name) "\n\n" @copyfiles-help)
  460.         (source  (cat "/Guide/" #guide_name ".info"))
  461.         (dest    #copydoc_target)
  462.         (newname (cat @app-name ".guide.info"))  
  463.     )
  464. )
  465.  
  466. ;==========================
  467. ;=== Copy rexx examples ===
  468. ;==========================
  469. (procedure P_CopyRexxExamples
  470.     (debug "Ask wether arexx examples to copy.")
  471.     ;;;
  472.     ; Copy arexx examples ?   
  473.     ;;;
  474.     (if (= @user-level 2)
  475.         (
  476.             (debug "Ask wether to install arexx examples.")
  477.             (set #copy_rexx
  478.                 (askbool
  479.                     (prompt  #rexx_f2c_prompt)
  480.                     (help    #rexx_f2c_help "\n\n" @askbool-help) 
  481.                     (default 1)
  482.                 )
  483.             )
  484.         )
  485.         ;else
  486.         (
  487.             (debug "Install arexx examples by default.")
  488.             (set #copy_rexx 1)
  489.         )
  490.     )
  491.     ;;;
  492.     ; Copy examples requested
  493.     ;;;
  494.     (if (= #copy_rexx 1)
  495.         (
  496.             (debug "Install rexx examples.")
  497.             ;;;
  498.             ; Get arexx drawer
  499.             ;;;
  500.             (if (= @user-level 2)
  501.                 (
  502.                     (debug "Ask target drawer for arexx")
  503.                     (set #copyrexx_target
  504.                         (askdir
  505.                             (prompt  #rexx_dest_prompt)
  506.                             (help    #rexx_dest_help "\n\n" @askdir-help)
  507.                             (default @default-dest)
  508.                             (newpath)
  509.                         )
  510.                     )
  511.                 )
  512.                 ;else
  513.                 (
  514.                     (debug "Set target for rexx to program drawer")
  515.                     (set #copyrexx_target @default-dest)
  516.                 )
  517.             )                                                
  518.             ;;;
  519.             ; Create drawer
  520.             ;;;
  521.             (set #copyrexx_target
  522.                 (tackon #copyrexx_target "Rexx")
  523.             )
  524.             (makedir #copyrexx_target)  
  525.             ;;;
  526.             ; Copy files
  527.             ;;;
  528.             (debug "Copying arexx examples.")
  529.             (copyfiles
  530.                 (prompt  #rexx_copy_prompt)
  531.                 (help    #rexx_copy_help "\n\n" @copyfiles-help)
  532.                 (source  "/Rexx/")
  533.                 (dest    #copyrexx_target)
  534.                 (all)              
  535.                 (confirm)
  536.             )                                               
  537.             (debug "ARexx examples copied.\n")
  538.         )
  539.     )
  540. )                                                      
  541.  
  542. ;=====================
  543. ;=== Set tooltypes ===
  544. ;=====================
  545. (procedure P_InitToolTypes
  546.     (debug "About to set tooltypes.")
  547.     ;;;
  548.     ; Pop up preferences keys
  549.     ;;;
  550.     (set #ttype_prefs_key
  551.         (askstring
  552.             (prompt (#ttype_prefs_prompt @app-name))
  553.             (help   #ttype_prefs_help "\n\n" @askstring-help)
  554.         )
  555.     )
  556.     (debug ("Prefs popup key is %s." #ttype_prefs_key))
  557.     ;;;
  558.     ; Pop up load key
  559.     ;;;
  560.     (set #ttype_load_key
  561.         (askstring
  562.             (prompt #ttype_load_prompt)
  563.             (help   #ttype_load_help "\n\n" @askstring-help)
  564.         )
  565.     )
  566.     (debug ("Prefs popup key is %s." #ttype_load_key))
  567.     ;;;
  568.     ; Pop up preferences after start
  569.     ;;;
  570.     (set #ttype_popup
  571.         (askbool
  572.             (prompt #ttype_popup_prompt)
  573.             (help   #ttype_popup_help "\n\n" @askbool-help)
  574.             (default 0)
  575.         )
  576.     )
  577.     (if (= #ttype_popup 0)
  578.         (
  579.             (set #ttype_popup "NO")
  580.         )
  581.         ;else
  582.         (
  583.             (set #ttype_popup "YES")
  584.         )
  585.     )
  586.     (debug ("Popup preferences after program start is set to %s." #ttype_popup))
  587.     ;;;
  588.     ; Adjust tooltypes
  589.     ;;;
  590.     (if (IN #program_files2copy 0) (P_SetToolTypes "68k"))
  591.     (if (IN #program_files2copy 1) (P_SetToolTypes "68k_fpu"))
  592.     (if (IN #program_files2copy 2) (P_SetToolTypes "PPC"))
  593.     ;;;
  594.     ; Copy icon to wbstartup
  595.     ;;;
  596.     (if (= #copy_wbstartup 1) (P_CopyWBStartup "68k"))
  597.     (if (= #copy_wbstartup 2) (P_CopyWBStartup "68k_fpu"))
  598.     (if (= #copy_wbstartup 3) (P_CopyWBStartup "PPC"))
  599. )
  600.  
  601. (procedure P_CopyWBStartup #main_type
  602.     (debug ("Copy %s icon to SYS:WBStartup/." #main_type))
  603.     (set #wbstartup_target "SYS:WBStartup/")
  604.     (copyfiles
  605.         (prompt  (#wbstart_prompt #main_type))
  606.         (help    #wbstart_help "\n\n" @copyfiles-help)
  607.         (source  "WBStartup_icon")
  608.         (dest    #wbstartup_target)
  609.         (newname (cat @app-name #main_type ".info"))
  610.         (confirm)
  611.     )                                          
  612.     (tooltype    
  613.         (dest (cat #wbstartup_target @app-name #main_type))
  614.         (setdefaulttool (cat (tackon @default-dest @app-name) #main_type))
  615.         (settooltype "LOADKEY"   #ttype_load_key)
  616.         (settooltype "CX_POPKEY" #ttype_prefs_key)
  617.         (settooltype "CX_POPUP"  #ttype_popup)
  618.         (settooltype "DONOTWAIT" "")
  619.         (setstack 16384)
  620.         (noposition)
  621.     )
  622. )                       
  623.  
  624. (procedure P_SetToolTypes #name_expand 
  625.     (debug ("Setting %s icon information." #name_expand))
  626.     (tooltype
  627.         (prompt (#ttype_set_prompt #name_expand))
  628.         (help #ttype_set_help)
  629.         (dest (cat (tackon @default-dest @app-name) #name_expand))
  630.         (settooltype "LOADKEY"   #ttype_load_key)
  631.         (settooltype "CX_POPKEY" #ttype_prefs_key)
  632.         (settooltype "CX_POPUP"  #ttype_popup)
  633.         (settooltype "DONOTWAIT" "")
  634.         (setstack 16384)
  635.         (noposition)
  636.         (confirm)
  637.     )
  638. )
  639.  
  640. ;=====================
  641. ;=== Install stuff ===
  642. ;=====================
  643. (procedure P_Install
  644.     (debug "Perform installation")
  645.     (welcome #welcome_text)
  646.  
  647.     (P_CopyMainFiles)
  648.     (complete 25)
  649.  
  650.     (P_CopyCatalogs)
  651.     (complete 50)
  652.  
  653.     (P_CopyDocs)
  654.     (complete 75)
  655.  
  656.     (P_CopyRexxExamples)
  657.     (complete 99)
  658.     ;
  659.     ;=== Copy icon to wbstartup
  660.     ;
  661.     (set #cpy_wbstart_68k     "")
  662.     (set #cpy_wbstart_68k_fpu "")
  663.     (set #cpy_wbstart_ppc     "")
  664.     (if (IN #program_files2copy 0) (set #cpy_wbstart_68k     (cat @app-name "68k")))
  665.     (if (IN #program_files2copy 1) (set #cpy_wbstart_68k_fpu (cat @app-name "68k FPU")))
  666.     (if (IN #program_files2copy 2) (set #cpy_wbstart_ppc     (cat @app-name "PPC")))
  667.     (set #copy_wbstartup
  668.         (askchoice
  669.             (prompt  #cpy_wbstartup_prompt)
  670.             (help    #cpy_wbstartup_help "\n\n" @askchoice-help)
  671.             (choices #cpy_wbstart_none
  672.                      #cpy_wbstart_68k
  673.                      #cpy_wbstart_68k_fpu
  674.                      #cpy_wbstart_ppc
  675.             )
  676.             (default 0)
  677.         )
  678.     )                    
  679.     (debug ("Copy to SYS:WBStartup/ is %ld." #copy_wbstartup))
  680.  
  681.     (P_InitToolTypes)
  682.     (complete 100)
  683. )
  684.  
  685. ;=======================================
  686. ;=== Update an existing installation ===
  687. ;=======================================
  688. (procedure P_Update
  689.     (debug "Perform update")
  690.     (welcome #welcome_update)
  691.     ;=== Get destination drawer ===
  692.     ;
  693.     (set #askdest_prompt #update_dest_prompt
  694.          #askdest_help   #update_dest_help  
  695.     )
  696.     (P_GetDestBaseDrawer)
  697.     (debug ("Old installation in %s." @default-dest))
  698.     ;=== Get files to update ===
  699.     ;
  700.     (set #update_files 0)
  701.     (P_FilesToUpdate "68k"     1)
  702.     (P_FilesToUpdate "68k_fpu" 2)
  703.     (P_FilesToUpdate "PPC"     4)
  704.     (debug ("Update executable bitmask is %ld.\n" #update_files))
  705.     (if (= #update_files 0)
  706.         (
  707.             (message #update_no_exe)
  708.             (exit (quiet))
  709.         )                                                            
  710.     )
  711.     ;=== Update main ===
  712.     ;                     
  713.     (if (IN #update_files 0)
  714.         (set #upd_68k (cat @app-name "68k"))
  715.         ;else
  716.         (set #upd_68k "")
  717.     )
  718.     (if (IN #update_files 1)
  719.         (set #upd_68k_fpu (cat @app-name "68k FPU"))
  720.         ;else
  721.         (set #upd_68k_fpu "")
  722.     )
  723.     (if (IN #update_files 2)
  724.         (set #upd_PPC (cat @app-name "PPC"))
  725.         ;else
  726.         (set #upd_PPC "")
  727.     )
  728.     (if (= @user-level 2)
  729.         (set #update_files
  730.             (askoptions
  731.                 (prompt  #update_f2c_prompt)
  732.                 (help    #update_f2c_help "\n\n" @askoptions-help)
  733.                 (choices #upd_68k
  734.                          #upd_68k_fpu
  735.                          #upd_PPC
  736.                 )
  737.                 (default 0)
  738.             )
  739.         )
  740.     )
  741.     (if (IN #update_files 0) (P_CopyOneExecutable "68k"))
  742.     (if (IN #update_files 1) (P_CopyOneExecutable "68k_fpu"))
  743.     (if (IN #update_files 2) (P_CopyOneExecutable "PPC"))
  744.     (debug "Main files updated.")
  745.     ;=== Update catalog(s) ===
  746.     ;                                   
  747.     (if (OR (= @user-level 2) (NOT (exists (tackon @default-dest "Catalogs"))))
  748.         (
  749.             (debug "Ask old catalogs drawer.")
  750.             (set #copycat_target
  751.                 (askdir
  752.                     (prompt  #update_cat_prompt)
  753.                     (help    #update_cat_help "\n\n" @askdir-help)
  754.                     (default @default-dest)
  755.                     (newpath)
  756.                 )
  757.             )
  758.         )      
  759.         ;else
  760.         (
  761.             (debug "Set target for catalogs to default destination.")
  762.             (set #copycat_target @default-dest)
  763.         )
  764.     )
  765.     (set #copycat_target
  766.         (tackon @default-dest "Catalogs")
  767.     )
  768.     (if (exists #copycat_target)
  769.         (foreach #copycat_target "#?"
  770.             (P_CopyOneCatalog @each-name)
  771.         )
  772.     )
  773.     (debug "Catalogs updated.")
  774.     ;=== Update doc ===
  775.     ;
  776.     (P_CopyDocs)
  777.     ;=== Update rexx ===
  778.     ;
  779.     (P_CopyRexxExamples)
  780.     (debug "Update complete.\n")
  781. )
  782.  
  783. (procedure P_FilesToUpdate #file_expand #bit_mask
  784.     (set #update_filename (cat (tackon @default-dest @app-name) #file_expand))
  785.     (debug ("Updating file %s ?" #update_filename))
  786.     (if (exists #update_filename)
  787.         (                    
  788.             (set #update_files (BITOR #update_files #bit_mask))
  789.             (debug ("\tUpdating old %s file." #update_filename))
  790.         )
  791.         ;else
  792.         (
  793.             (debug "\tNo old installation found.")
  794.         ) 
  795.     )
  796. )
  797.  
  798. ;====================================
  799. ;=== Remove existing installation ===
  800. ;====================================
  801. (procedure P_Remove
  802.     (debug "Perform remove")    
  803.     (welcome #welcome_remove)
  804.     ;=== Get destination drawer ===
  805.     ;
  806.     (set #askdest_prompt #update_dest_prompt  
  807.          #askdest_help   #update_dest_help    
  808.     )
  809.     (P_GetDestBaseDrawer)
  810.     (debug ("Drawer to remove is %s." @default-dest)) 
  811.     ;=== Main executable(s) there ? ===
  812.     ;
  813.     (debug "Main executable(s) there ?")
  814.     (if (NOT (exists (cat (tackon @default-dest @app-name) "68k")))
  815.         (
  816.             (if (NOT (exists (cat (tackon @default-dest @app-name) "68k_fpu")))
  817.                 (
  818.                     (if (NOT (exists (cat (tackon @default-dest @app-name) "PPC")))
  819.                         (
  820.                             (message #remove_no_exe)
  821.                             (exit (quiet))
  822.                         )
  823.                     )
  824.                 )
  825.             )
  826.         )
  827.     )    
  828.     ;=== Remove drawer ===
  829.     ;
  830.     (set #really_delete
  831.         (askbool
  832.             (prompt  #remove_safe_prompt)
  833.             (help    #remove_safe_help "\n\n" @askbool-help)
  834.             (default 0)
  835.         )
  836.     )
  837.     (if (= #really_delete 1)
  838.         (
  839.             (debug ("Deleting drawer %s." @default-dest))
  840.             (set @default-dest (tackon @default-dest "/"))
  841.             (set @default-dest (substr @default-dest 0 (- (strlen @default-dest) 2)))
  842.             (delete @default-dest
  843.                 (prompt #remove_del_prompt)
  844.                 (help   #remove_del_help)
  845.                 (all)
  846.                 (optional askuser)
  847.                 (confirm)
  848.             )                                             
  849.             (delete (cat @default-dest ".info")
  850.                 (prompt #remove_del_prompt)
  851.                 (help   #remove_del_help) 
  852.                 (optional askuser)  
  853.             )          
  854.             (set @default-dest "RAM:")
  855.         )
  856.     )
  857. )
  858.  
  859. ;============
  860. ;=== Main ===
  861. ;============                        
  862. (complete 0)
  863.           
  864. ;=== Check 68k processor version ===
  865. ;
  866. (debug ("CPU is a %s." (database "cpu")))
  867. (if (patmatch "(68000|68010)" (database "cpu"))
  868.     (
  869.         (message #cpu_too_low)
  870.         (exit (quiet))
  871.     )
  872. )                                 
  873. ;=== Check installer version & exit eventually ===
  874. ;
  875. (set #install_ver (/ @installer-version 65536))
  876. (set #install_rev (- @installer-version (* #install_ver 65536))) 
  877. (debug ("Installer version %ld.%ld." #install_ver #install_rev))
  878. (if (< #install_ver 43)
  879.     (
  880.         (debug "Installer version too low.")           
  881.         (set #installer_ok
  882.             (askbool
  883.                 (prompt (#error_instvers_msg #install_ver #install_rev))
  884.                 (help   #error_instvers_help "\n\n" @askbool-help)
  885.                 (default 0)
  886.             )
  887.         )
  888.     )
  889.     ;else
  890.     (
  891.         (debug "Installer version is ok.")
  892.         (set #installer_ok 1)
  893.     )
  894. )
  895. (if (NOT #installer_ok)
  896.     (
  897.         (debug "Aborting installation.")
  898.         (exit (quiet))
  899.     )
  900. )
  901. ;=== Select type of action ===
  902. ;                       
  903. (set #type_of_action
  904.     (askchoice
  905.         (prompt  #action_prompt)
  906.         (help    #action_help "\n\n" @askchoice-help)
  907.         (choices
  908.             #action_install
  909.             #action_update
  910.             #action_remove
  911.         )
  912.     )
  913. )                                                  
  914. (if (= #type_of_action 0) (P_Install))
  915. (if (= #type_of_action 1) (P_Update))
  916. (if (= #type_of_action 2) (P_Remove))
  917. (exit)
  918.